<template>
    <div>
        <div v-for="item in items" :key="item.name">
            <Submenu name="1" v-if="item.children!=null && item.children.length>0">
                <template slot="title">
                            <Icon type="ios-navigate" :size="iconSize"></Icon>
                            <span class="layout-text">{{item.name}}</span>
                </template>
                <DynamicMenus :items="item.children"></DynamicMenus>
            </Submenu>
            <MenuItem :name="item.name" v-else>
                <Icon type="ios-keypad" :size="iconSize"></Icon>
                <span class="layout-text">{{item.name}}</span>
            </MenuItem>
        </div>
    </div>
</template>

<script>

export default {
    name:"DynamicMenus",
    props:["items","baseName"],
    data(){
        return {
            spanLeft: 4,
            spanRight: 20,
        }
    },
    created:function(){
        //this.$options.components.DynamicMenus = require('./DynamicMenus')
    },
    beforeCreate: function () {
        
    },
    computed: {
        iconSize() {
            return this.spanLeft === 4 ? 14 : 24;
        }
    },
    beforeMount(){
        console.log(this)
    },
    methods:{
        redirect(){
            alert("2323")
        }
    }
}
</script>

